﻿
namespace WITD
{
    /// <summary>
    /// Stores options related to how the user selects to copy work item types and work items.
    /// </summary>
    public class WITDCopyOptions
    {
        private WITDOptions _options;
        private bool _removeWITDs;
        private bool _includeWITDs;
        private bool _includeWorkItems;
        private bool _allowRemoval;
        private bool _validateOnly;

        /// <summary>
        /// Constructor for WITDCopyOptions class.
        /// </summary>
        /// <param name="newOptions">The new <see cref="WITDOptions"> WITDOptions</see> object with values set.</param>
        /// <param name="newRemoveWITDs">True to remove work item types from target projects that are not in the source project. This is only allowed 
        /// if all work item types are selected for copy in the source project.</param>
        /// <param name="newIncludeWITDs">True to copy the selected work item types from the source project to each selected target project.</param>
        /// <param name="newIncludeWorkItems">True to copy work item instances of the same types copied from the source project.</param>
        /// <param name="allSourceWITDsSelected">Denotes whether the user selected all the WITDs from the source project.</param>
        public WITDCopyOptions(WITDOptions newOptions, bool newRemoveWITDs, bool newIncludeWITDs, bool newIncludeWorkItems, bool allSourceWITDsSelected)
        {
            _options = newOptions;
            _removeWITDs = newRemoveWITDs;
            _includeWITDs = newIncludeWITDs;
            _includeWorkItems = newIncludeWorkItems;
            _allowRemoval = allSourceWITDsSelected;
        }

        /// <summary>
        /// Default constructor.
        /// </summary>
        public WITDCopyOptions()
        {
            _removeWITDs = false;
            _includeWITDs = false;
            _includeWorkItems = false;
            _allowRemoval = false;
        }

        /// <summary>
        /// Sets the AllowRemoval flag as specified.
        /// </summary>
        /// <param name="allow">True to allow removal of work item types that are not in the source project. Otherwise false.
        /// <para></para> <para></para>
        /// Removal of uncopied work item types is only allowed if all work item types are selected for copy to target projects.
        /// </param>
        public void SetAllowRemoval(bool allow)
        {
            _allowRemoval = allow;
        }

        /// <summary>
        /// Denotes whether removal of uncopied work item types is permissible.
        /// </summary>
        public bool AllowWITDRemoval
        { get { return _allowRemoval; } }

        /// <summary>
        /// <see cref="WITDOptions">WITDOptions object</see> that denotes how to copy work item types.
        /// </summary>
        public WITDOptions Options
        {
            get
            {
                return _options;
            }
            set
            {
                _options = value;
            }
        }

        /// <summary>
        /// True to remove uncopied work item types. Otherwise false.
        /// </summary>
        public bool RemoveWITDs
        {
            get
            {
                return _removeWITDs;
            }
            set
            {
                _removeWITDs = value;
            }
        }

        /// <summary>
        /// True to remove uncopied work item types. Otherwise false.
        /// </summary>
        public bool ValidateOnly
        {
            get
            {
                return _validateOnly;
            }
            set
            {
                _validateOnly = value;
            }
        }

        /// <summary>
        /// True to copy work item types to target projects. Otherwise false.
        /// </summary>
        public bool IncludeWITDs
        {
            get
            {
                return _includeWITDs;
            }
            set
            {
                _includeWITDs = value;
            }
        }

        /// <summary>
        /// True to copy work items to a single target project of the same types as are selected for copy. Only allowed if one target project is selected.
        /// </summary>
        public bool IncludeWorkItems
        {
            get
            {
                return _includeWorkItems;
            }
            set
            {
                _includeWorkItems = value;
            }
        }
    }

    /// <summary>
    /// Stores options related to how the user selects to copy work item iterations.
    /// </summary>
    public class IterationCopyOptions
    {
        private IterationOptions _options;
        private bool _includeIterations;

        /// <summary>
        /// Options related to how to copy iterations to target projects.
        /// </summary>
        public IterationOptions Options
        {
            get
            {
                return _options;
            }
            set
            {
                _options = value;
            }
        }

        /// <summary>
        /// True to copy iterations to target projects. Otherwise false.
        /// </summary>
        public bool IncludeIterations
        {
            get
            {
                return _includeIterations;
            }
            set
            {
                _includeIterations = value;
            }
        }
    }

    /// <summary>
    /// Stores options related to how the user selects to copy global lists.
    /// </summary>
    public class GlobalListCopyOptions
    {
        private GlobalListOptions _options;
        private bool _includeGlobalList;

        /// <summary>
        /// Options related to how to copy global lists to a different collection.
        /// </summary>
        public GlobalListOptions Options
        {
            get
            {
                return _options;
            }
            set
            {
                _options = value;
            }
        }

        /// <summary>
        /// True to copy global lists to the target collection. Otherwise false.
        /// </summary>
        public bool IncludeGlobalList
        {
            get
            {
                return _includeGlobalList;
            }
            set
            {
                _includeGlobalList = value;
            }
        }
    }

    /// <summary>
    /// Stores options related to how the user selects to copy work item queries.
    /// </summary>
    public class QueryCopyOptions
    {
        private QueryOptions _options;
        private bool _includeQueries;
        private bool _removeQueries;

        /// <summary>
        /// Options related to how to copy work item queries to target projects.
        /// </summary>
        public QueryOptions Options
        {
            get
            {
                return _options;
            }
            set
            {
                _options = value;
            }
        }

        /// <summary>
        /// True to copy work item queries to target projects. Otherwise false.
        /// </summary>
        public bool IncludeQueries
        {
            get
            {
                return _includeQueries;
            }
            set
            {
                _includeQueries = value;
            }
        }

        /// <summary>
        /// True to remove queries from target projects that are not in the source project. Otherwise false to leave them.
        /// </summary>
        public bool RemoveQueries
        {
            get
            {
                return _removeQueries;
            }
            set
            {
                _removeQueries = value;
            }
        }
    }
    
}


